package top.linyuxb.lycloud.admin.repository;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import top.linyuxb.lycloud.admin.entity.LyConfProjectEntity;

/**
 * Created by Intellij IDEA.
 *
 * @Author: linyuxb
 * @Date: 2024/7/29 14:58
 * @Desc:
 */
@Repository
public interface LyConfProjectRepository extends BaseRepository<LyConfProjectEntity, Long> {
    /**
     * 项目查询
     *
     * @param app
     * @return
     */
    LyConfProjectEntity findByApp(String app);

    /**
     * 项目删除
     *
     * @param app
     * @return
     */
    @Modifying
    @Transactional
    @Query(value = "UPDATE ly_conf_project SET status = 0 WHERE app = ?1 and status = 1", nativeQuery = true)
    Integer deleteByApp(String app);
}
